<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="chtml" uri="http://www.szhelper.com/jsp/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>新增企业用户</title>
<style type="text/css">
#layout_documentation {
	background: #fff;
}

table.data_table_main {
	width: 50%;
}
</style>
</head>
<body>
	<script type="text/javascript">
		function valid4userInfo(label, pattern, value, validEle, maskEle,
				isCheckNull) {
			value = value.replace(/(^\s*)|(\s*$)/g, "");
			if (value.length > 0) {
				if (new RegExp(pattern).test(value)) {
					$('#' + validEle + '').hide();
					$('#' + maskEle + '').hide();
					return true;
				} else {
					$('#' + validEle + '').html(
							"<label>&nbsp;</label>" + label + "格式错误");
					$('#' + validEle + '').show();
					$('#' + maskEle + '').show();
					return false;
				}
				;
			} else {
				if (isCheckNull == 'true') {
					$('#' + validEle + '').html(
							"<label>&nbsp;</label>" + label + "不能为空");
					$('#' + validEle + '').show();
					$('#' + maskEle + '').show();
					return false;
				} else {
					$('#' + validEle + '').hide();
					$('#' + maskEle + '').hide();
					return true;
				}
			}
		}
		function isNull4borrowInfo(label, eleName, validEle, maskEle) {
			var flag = false;
			var checkvalue = $("input[name='" + eleName + "']");
			checkvalue.each(function() {
				if (this.checked == true) {
					flag = true;
				}
			});
			if (!flag) {
				$('#' + validEle + '').html(
						"<label>&nbsp;</label>" + label + "不能为空");
				$('#' + validEle + '').show();
				$('#' + maskEle + '').show();
				return false;
			} else {
				$('#' + validEle + '').hide();
				$('#' + maskEle + '').hide();
				return true;
			}
		}

		// userInfo数据列表表单提交脚本
		function _submitAction4userInfo(obj, action, params) {
			var submitForm;
			while ((obj.parentNode) && (obj.parentNode.tagName)
					&& (!obj.parentNode.tagName.match(/FORM/i))) {
				obj = obj.parentNode;
			}
			submitForm = obj.parentNode;
			if (!submitForm) {
				submitForm = document.createElement("form");
				document.body.appendChild(submitForm);
			}
			submitForm.setAttribute("action", action);
			submitForm.setAttribute("method", "POST");
			for ( var key in params) {
				var hiddenField = document.createElement("input");
				hiddenField.setAttribute("type", "hidden");
				hiddenField.setAttribute("name", key);
				hiddenField.setAttribute("value", params[key]);
				submitForm.appendChild(hiddenField);
			}
			if (submit4userInfo())
				submitForm.submit();
		}
	</script>
	<div class="youarehere">
		用户管理 &gt;<span>新增企业用户</span>&gt;
	</div>
	<form id="userInfo" action="<%=request.getContextPath()%>/user/addCorp"
		method="POST" onsubmit="return submit4userInfo();">
		<table class="data_table_main">
			<tr>
				<td
					background="<%=request.getContextPath()%>/layout/list/tab_top.gif">
					<!-- userInfo标题头 -->
					<table class="data_table_title">
						<tr height="30">
							<td align='left'><img
								src="<%=request.getContextPath()%>/layout/list/list.gif"
								width="16" height="16" />新增企业用户</td>
							<td align='right'>&nbsp;</td>
						</tr>
					</table></td>
			</tr>
			<tr>
				<td>
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>

							<!-- userInfo数据区 -->
							<table id="main_table4userInfo" class="data_table_command">
								<tr>
									<td class="data_tab_tdr">用户名<span style="color: red;">*</span>
									</td>
									<td class="data_tab_tdl"><input id="userName" type="text"
										name="userName" value="" />&nbsp;<span style="color: red;">*</span>
										<div id="mask4userName" style="display: none;"></div>
										<div id="valid4userName"
											style="display: none; color: red; font-size: small;"></div></td>
								</tr>
								<tr>
									<td class="data_tab_tdr">企业全称<span style="color: red;">*</span>
									</td>
									<td class="data_tab_tdl"><input id="realName" type="text"
										name="realName" value="" />&nbsp;<span style="color: red;">*</span>
										<div id="mask4realName" style="display: none;"></div>
										<div id="valid4realName"
											style="display: none; color: red; font-size: small;"></div></td>
								</tr>
								<tr>
									<td class="data_tab_tdr">企业简称<span style="color: red;">*</span>
									</td>
									<td class="data_tab_tdl"><input id="shortName" type="text"
										name="shortName" value="" />&nbsp;<span style="color: red;">*</span>
										<div id="mask4shortName" style="display: none;"></div>
										<div id="valid4shortName"
											style="display: none; color: red; font-size: small;"></div></td>
								</tr>
								<tr>
									<td class="data_tab_tdr">企业类型<span style="color: red;">*</span>
									</td>
									<td class="data_tab_tdl"><select id="type" name="type">
											<option value='ENTERPRISE'>企业用户</option>
											<option value='GUARATOR'>担保企业用户</option>
									</select> &nbsp;<span style="color: red;">*</span>
										<div id="mask4realName" style="display: none;"></div>
										<div id="valid4realName"
											style="display: none; color: red; font-size: small;"></div></td>
								</tr>
								<tr>
									<td class="data_tab_tdr">组织结构代码<span style="color: red;">*</span>
									</td>
									<td class="data_tab_tdl"><input id="organizeCode"
										type="text" name="organizeCode" value="" />&nbsp;<span
										style="color: red;">*</span>
										<div id="mask4organizeCode" style="display: none;"></div>
										<div id="valid4organizeCode"
											style="display: none; color: red; font-size: small;"></div></td>
								</tr>
								<tr>
									<td class="data_tab_tdr">企业税务登记号<span style="color: red;">*</span>
									</td>
									<td class="data_tab_tdl"><input id="taxCode" type="text"
										name="taxCode" value="" />&nbsp;<span style="color: red;">*</span>
										<div id="mask4taxCode" style="display: none;"></div>
										<div id="valid4taxCode"
											style="display: none; color: red; font-size: small;"></div></td>
								</tr>
								<tr>
									<td class="data_tab_tdr">开户银行许可证<span style="color: red;">*</span>
									</td>
									<td class="data_tab_tdl"><input id="bankPermitCode"
										type="text" name="bankPermitCode" value="" />&nbsp;<span
										style="color: red;">*</span>
										<div id="mask4bankPermitCode" style="display: none;"></div>
										<div id="valid4bankPermitCode"
											style="display: none; color: red; font-size: small;"></div></td>
								</tr>
								<tr>
									<td class="data_tab_tdr">营业执照编号<span style="color: red;">*</span>
									</td>
									<td class="data_tab_tdl"><input id="busiCode"
										type="text" name="busiCode" value="" />&nbsp;<span
										style="color: red;">*</span>
										<div id="mask4busiCode" style="display: none;"></div>
										<div id="valid4busiCode"
											style="display: none; color: red; font-size: small;"></div></td>
								</tr>
								<tr>
									<td class="data_tab_tdr">是否投资人<span style="color: red;">*</span>
									</td>
									<td class="data_tab_tdl"><chtml:enum name="isInvestor"
											textProperty="text" selected="NO"
											type="com.hengpeng.common.persist.entity.AbstractEntity$BoolValue" />
										<span
										style="color: gray; font-style: italic; font-size: small;"></span>
										<div id="mask4isInvestor" style="display: none;"></div>
										<div id="valid4isInvestor"
											style="display: none; color: red; font-size: small;"></div></td>
								</tr>
								<tr>
									<td class="data_tab_tdr">是否融资人<span style="color: red;">*</span>
									</td>
									<td class="data_tab_tdl"><chtml:enum name="isBorrower"
											textProperty="text" selected="NO"
											type="com.hengpeng.common.persist.entity.AbstractEntity$BoolValue" />
										<span
										style="color: gray; font-style: italic; font-size: small;"></span>
										<div id="mask4isBorrower" style="display: none;"></div>
										<div id="valid4isBorrower"
											style="display: none; color: red; font-size: small;"></div>
									</td>
								</tr>
								<tr>
									<td colspan="2" align="center" height="25" class="data_tab_td"><button
											type="button"
											onclick="javascript:if(true){void(_submitAction4userInfo(this,'<%=request.getContextPath()%>/user/save',{}));return false;}" />·新增·
										</button>&nbsp;&nbsp;
										<button type="button"
											onclick="javascript:void(history.back(-1))">·返回·</button>
									</td>
								</tr>
							</table>
							</td>
						</tr>
					</table></td>
			</tr>
			<tr>
				<td
					background="<%=request.getContextPath()%>/layout/list/tab_bottom.gif">
					<table class="data_table_pagination" align='center' cellpadding='0'
						cellspacing='0'>
						<tr>
							<td width="12" height="35"><img
								src="<%=request.getContextPath()%>/layout/list/tab_left_bottom.gif"
								width="12" height="35" />
							</td>
							<td>&nbsp;</td>
							<td width="16"><img
								src="<%=request.getContextPath()%>/layout/list/tab_right_bottom.gif"
								width="16" height="35" />
							</td>
						</tr>
					</table></td>
			</tr>
		</table>
		<!-- userInfo结束 -->
		<input id="id" type="hidden" name="id" value="" /> <input id="token"
			type="hidden" name="token" value="${token}" />
	</form>
	<script type="text/javascript">
		function submit4userInfo() {
			var validResult = true;
			if (validResult) {
				validResult = valid4userInfo('用户名称', '^[\\s\\S]*$', $(
						'#userName').val(), 'valid4userName', 'mask4userName',
						'true');
			}
			if (validResult) {
				validResult = valid4userInfo('企业全称', '^[\\s\\S]*$', $(
						'#realName').val(), 'valid4realName', 'mask4realName',
						'true');
			}
			if (validResult) {
				validResult = valid4userInfo('企业简称', '^[\\s\\S]*$', $(
						'#shortName').val(), 'valid4shortName',
						'mask4shortName', 'true');
			}
			if (validResult) {
				validResult = valid4userInfo('组织机构代码', '^[\\s\\S]*$', $(
						'#organizeCode').val(), 'valid4organizeCode',
						'mask4organizeCode', 'true');
			}
			if (validResult) {
				validResult = valid4userInfo('企业税务登记号', '^[\\s\\S]*$', $(
						'#taxCode').val(), 'valid4taxCode', 'mask4taxCode',
						'true');
			}
			if (validResult) {
				validResult = valid4userInfo('开户银行许可证', '^[\\s\\S]*$', $(
						'#bankPermitCode').val(), 'valid4bankPermitCode',
						'mask4bankPermitCode', 'true');
			}
			if (validResult) {
				validResult = valid4userInfo('营业执照编号', '^[\\s\\S]*$', $(
						'#busiCode').val(), 'valid4busiCode',
						'mask4busiCode', 'true');
			}
			return validResult;
		}
		new ResizeWidget('main_table4userInfo');
	</script>
</body>
</html>